aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/+layout.server.js
blob: 7823f7de668437a29b4cc7547c21f02f328163fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { get } from '$lib/utils';
import { error } from '@sveltejs/kit';

export let load = async ({ params: { username } }) => {
	try {
		return { subject: await get(`/users/${username}`) };
	} catch (e) {
		if (username.length === 64)
			return { subject: { username: username.substr(0, 6), pubkey: username, anon: true } };
		throw error(500, 'Unable to retrieve user account data');
	}
};